package hichecker.university;

import hichecker.controller.MainController;
import hichecker.ui.components.icon_factory.IconFactory.IconType;
import hichecker.ui.custom_views.conflict_handling.ConflictView;
import hichecker.ui.general_views.container_panel.content.ContentPanel;

import java.util.List;
import java.util.UUID;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@XmlRootElement
public class ImportExportCourse extends Course {

	private @XmlElement UUID importID;
	private @XmlElement String checker;

	public ImportExportCourse() {
		importID = UUID.randomUUID();
	}

	public ImportExportCourse(UUID importID) {
		this.importID = importID;
	}

	public ImportExportCourse(Course course) {
		super(course);
		importID = UUID.randomUUID();
	}

	@XmlTransient
	public UUID getImportID() {
		return importID;
	}

	public void setImportID(UUID importID) {
		this.importID = importID;
	}

	@XmlTransient
	public String getChecker() {
		return checker;
	}

	public void setChecker(String checker) {
		this.checker = checker;
	}

	// TODO richtigen namen?
//	@Override
//	public String getName() {
//		return "Import: " + getRequirements().get(0).getName() + " - "
//				+ getTheOnlySeries().getName();
//	}

	@Override
	public IconType getIcon() {
		return IconType.IMPORTED_FILE;
	}

	@Override
	public List<UniversityPart> getSubParts() {
		return null;
	}

	@Override
	public ContentPanel getRepresentation(boolean showConfig, MainController controller) {
		return new ConflictView(this, controller);
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof ImportExportCourse))
			return false;
		return ((ImportExportCourse) o).getImportID().equals(importID);
	}
}
